package com.luxf.base.domainevent.repository;

import com.luxf.base.domainevent.constants.SentStatus;
import com.luxf.base.domainevent.model.MessageSentHistory;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Lock;
import org.springframework.stereotype.Repository;

import javax.persistence.LockModeType;
import java.util.List;

/**
 * @author fast66
 * 2021-05-26 11:32
 **/
@Repository
public interface MessageSentHistoryRepository extends JpaRepository<MessageSentHistory, String> {

    @Lock(value = LockModeType.PESSIMISTIC_WRITE)
    List<MessageSentHistory> findAllByStatusInOrderByCreatedDateAsc(List<SentStatus> statusList);
}
